// Helper for connection operations.

#include "Common.h"

static wstring_convert<codecvt_utf8_utf16<wchar_t>, wchar_t> m_converter;

// Convert from UTF-8 to UTF-16.
wstring Common::Widen(const char* source)
{
	return m_converter.from_bytes(source);
}

// Convert from UTF-8 to UTF-16.
wstring Common::Widen(const string& source)
{
	return m_converter.from_bytes(source);
}

// Convert from UTF-16 to UTF-8.
string Common::Narrow(const wchar_t* source)
{
	return m_converter.to_bytes(source);
}

// Convert from UTF-16 to UTF-8.
string Common::Narrow(const wstring& source)
{
	return m_converter.to_bytes(source);
}